package com.example.springboot.chapter3.config;

import com.example.springboot.chapter3.pojo.BusinessPerson;
import com.example.springboot.chapter3.pojo.User;
import com.example.springboot.chapter3.pojo.definition.Person;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.logging.Logger;

public class IoCTest {
    private static Logger logger = Logger.getLogger("chapter3");

    public static void main(String[] args) {
        ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
        User user = ctx.getBean(User.class);
        logger.info(user.toString());

        Person person = ctx.getBean(BusinessPerson.class);
        person.service();
    }
}
